package entity;

public class ECoordinateRegister  extends ENumberRegister {
	private double value = -1.;
	
	public ECoordinateRegister(String name, int address, String dataType,
			String description, String unit, double min, double max) {
		super(name, address, dataType, description, false, unit, min, max);
	}

	@Override
	public Object getValue() {
		return value;
	}

	@Override
	public void setValue(byte b0, byte b1, byte b2, byte b3) {
		
		double newValue = (((byte) b3 & 0xff)) + (((int) b0 & 0xff) + 
				(((int) b1 & 0xff) << 8) + (((int) b2 & 0xff) << 16))/Math.pow(10,6);
		this.value = newValue;
		setChanged();
		notifyObservers(value);
	}
        
    @Override
    public String toString(){
        return String.valueOf(value);     
    }
}